Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft of use_crate() #361

Merged
merged 6 commits into from
Aug 3, 2024
Merged

draft of use_crate() #361

merged 6 commits into from
Aug 3, 2024

Conversation

kbvernon
Copy link
Contributor

For #360

R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
R/use_crate.R Outdated Show resolved Hide resolved
@Ilia-Kosenkov
Copy link
Member

Do we need all two files, 400 lines each? Can we trim it only to used functions?

@kbvernon
Copy link
Contributor Author

kbvernon commented Aug 2, 2024

Possibly, but if we intend to incrementally update other parts of rextendr to use these standalone checks, maybe we should think about which ones we are likely to use elsewhere (not just for this function) and then trim everything else. What do you think, @JosiahParry?

@JosiahParry
Copy link
Contributor

I think including the files is helpful for the future development of the package. I would suggest to keep them as is.

This is because they add no other dependencies hence "standalone." Together they are 20kb which is very small. If size is a concern we can remove comments and whitespace. But again, this is a utility package, not one that is included in the final binary of another.

Copy link
Contributor

@JosiahParry JosiahParry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Thank you for making this change. This alone will simplify the process of adding crates to one's Cargo.toml lowering the bar to entry for writing Rust powered R packages.

If the standalone checks become an issue later while running checks prior to new version release we can revisit.

However, I think that they provide a significant QOL improvement that should not be overlooked.

@JosiahParry JosiahParry merged commit 3da0d06 into extendr:main Aug 3, 2024
16 of 17 checks passed
Copy link
Member

@CGMossa CGMossa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is fine as is right now.

I don't see a need to hand modify these functions and helpers to fit neatly in with this PR solely. It is a tool discovered by this PR, and should just be added if we like it.

@kbvernon
Copy link
Contributor Author

kbvernon commented Aug 3, 2024

Awesome! Thanks! If you all want someone to work on integrating/modifying the standalone checks more, I can probably devote some time to it next month.

@Ilia-Kosenkov
Copy link
Member

@kbvernon , could you please also update NEWS.md since this is function is a part of public API?

@kbvernon
Copy link
Contributor Author

kbvernon commented Aug 3, 2024

can do! thanks, @Ilia-Kosenkov!

This was referenced Aug 3, 2024
@kbvernon kbvernon deleted the use_crate branch September 7, 2024 20:51
)

# clear empty options
cargo_add_opts <- purrr::discard(cargo_add_opts, rlang::is_empty)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change broke the function. Looks like we might be missing a test for this. I installed the new version

rextendr::use_crate("lazy-static")
Running cargo add lazy-static '--features ' '--optional false'
Error:
! ! System command 'cargo' failed

This is because "--features " is included in the vector that is passed to processx. --features

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i see this:

purrr::discard(list(a = "", b = 1, c = NULL), rlang::is_empty)
# $a
# [1] ""
# 
# $b
# [1] 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and

paste(NULL)
# character(0)
paste(NULL, collapse = " ")
# ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants